import useSystemStore from '.';
import useUserStore from '../user';

/**
 * @description: 获取系统后端路径
 * @param {string} path 拼接路径
 */
export const getHost = (path: string = '') => {
  const systemStore = useSystemStore();
  return systemStore.$state.developer.baseURL + path;
};

/* 获取静态资源目录 */
export const getStaticHost = (path = '') => {
  return getHost(`profile/${path}`);
};

/* 获取文件 */
export const previewVideo = (filePath: string) => {
  const systemStore = useUserStore();
  return getHost(
    `public/previewVideo?path=${encodeURIComponent(filePath)}&token=${systemStore.$state.token}`,
  );
};
